3.3.94 \(\int \cos ^2(e+f x) (a+b \sin ^2(e+f x))^2 \, dx\) [294]

3.3.94.1 Optimal result
3.3.94.2 Mathematica [C] (verified)
3.3.94.3 Rubi [A] (verified)
3.3.94.4 Maple [A] (verified)
3.3.94.5 Fricas [A] (verification not implemented)
3.3.94.6 Sympy [B] (verification not implemented)
3.3.94.7 Maxima [A] (verification not implemented)
3.3.94.8 Giac [A] (verification not implemented)
3.3.94.9 Mupad [B] (verification not implemented)

3.3.94.1 Optimal result

Integrand size = 23, antiderivative size = 116 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {1}{16} \left (8 a^2+4 a b+b^2\right ) x+\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f} \]

output
1/16*(8*a^2+4*a*b+b^2)*x+1/16*(8*a^2+4*a*b+b^2)*cos(f*x+e)*sin(f*x+e)/f-1/ 
24*b*(8*a+3*b)*cos(f*x+e)^3*sin(f*x+e)/f-1/6*b*cos(f*x+e)^5*sin(f*x+e)*(a+ 
(a+b)*tan(f*x+e)^2)/f
 
3.3.94.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 2.24 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.68 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {12 ((2-2 i) a+b) ((2+2 i) a+b) (e+f x)+3 (4 a-b) (4 a+b) \sin (2 (e+f x))-3 b (4 a+b) \sin (4 (e+f x))+b^2 \sin (6 (e+f x))}{192 f} \]

input
Integrate[Cos[e + f*x]^2*(a + b*Sin[e + f*x]^2)^2,x]
 
output
(12*((2 - 2*I)*a + b)*((2 + 2*I)*a + b)*(e + f*x) + 3*(4*a - b)*(4*a + b)* 
Sin[2*(e + f*x)] - 3*b*(4*a + b)*Sin[4*(e + f*x)] + b^2*Sin[6*(e + f*x)])/ 
(192*f)
 
3.3.94.3 Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.10, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 3670, 315, 298, 215, 216}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \cos (e+f x)^2 \left (a+b \sin (e+f x)^2\right )^2dx\)

\(\Big \downarrow \) 3670

\(\displaystyle \frac {\int \frac {\left ((a+b) \tan ^2(e+f x)+a\right )^2}{\left (\tan ^2(e+f x)+1\right )^4}d\tan (e+f x)}{f}\)

\(\Big \downarrow \) 315

\(\displaystyle \frac {\frac {1}{6} \int \frac {3 (a+b) (2 a+b) \tan ^2(e+f x)+a (6 a+b)}{\left (\tan ^2(e+f x)+1\right )^3}d\tan (e+f x)-\frac {b \tan (e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 \left (\tan ^2(e+f x)+1\right )^3}}{f}\)

\(\Big \downarrow \) 298

\(\displaystyle \frac {\frac {1}{6} \left (\frac {3}{4} \left (8 a^2+4 a b+b^2\right ) \int \frac {1}{\left (\tan ^2(e+f x)+1\right )^2}d\tan (e+f x)-\frac {b (8 a+3 b) \tan (e+f x)}{4 \left (\tan ^2(e+f x)+1\right )^2}\right )-\frac {b \tan (e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 \left (\tan ^2(e+f x)+1\right )^3}}{f}\)

\(\Big \downarrow \) 215

\(\displaystyle \frac {\frac {1}{6} \left (\frac {3}{4} \left (8 a^2+4 a b+b^2\right ) \left (\frac {1}{2} \int \frac {1}{\tan ^2(e+f x)+1}d\tan (e+f x)+\frac {\tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}\right )-\frac {b (8 a+3 b) \tan (e+f x)}{4 \left (\tan ^2(e+f x)+1\right )^2}\right )-\frac {b \tan (e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 \left (\tan ^2(e+f x)+1\right )^3}}{f}\)

\(\Big \downarrow \) 216

\(\displaystyle \frac {\frac {1}{6} \left (\frac {3}{4} \left (8 a^2+4 a b+b^2\right ) \left (\frac {1}{2} \arctan (\tan (e+f x))+\frac {\tan (e+f x)}{2 \left (\tan ^2(e+f x)+1\right )}\right )-\frac {b (8 a+3 b) \tan (e+f x)}{4 \left (\tan ^2(e+f x)+1\right )^2}\right )-\frac {b \tan (e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 \left (\tan ^2(e+f x)+1\right )^3}}{f}\)

input
Int[Cos[e + f*x]^2*(a + b*Sin[e + f*x]^2)^2,x]
 
output
(-1/6*(b*Tan[e + f*x]*(a + (a + b)*Tan[e + f*x]^2))/(1 + Tan[e + f*x]^2)^3 
 + (-1/4*(b*(8*a + 3*b)*Tan[e + f*x])/(1 + Tan[e + f*x]^2)^2 + (3*(8*a^2 + 
 4*a*b + b^2)*(ArcTan[Tan[e + f*x]]/2 + Tan[e + f*x]/(2*(1 + Tan[e + f*x]^ 
2))))/4)/6)/f
 

3.3.94.3.1 Defintions of rubi rules used

rule 215
Int[((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[(-x)*((a + b*x^2)^(p + 1) 
/(2*a*(p + 1))), x] + Simp[(2*p + 3)/(2*a*(p + 1))   Int[(a + b*x^2)^(p + 1 
), x], x] /; FreeQ[{a, b}, x] && LtQ[p, -1] && (IntegerQ[4*p] || IntegerQ[6 
*p])
 

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 298
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-( 
b*c - a*d))*x*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] - Simp[(a*d - b*c*( 
2*p + 3))/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1), x], x] /; FreeQ[{a, b, 
 c, d, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/2 + p, 0])
 

rule 315
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_), x_Symbol] :> Sim 
p[(a*d - c*b)*x*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q - 1)/(2*a*b*(p + 1))), 
x] - Simp[1/(2*a*b*(p + 1))   Int[(a + b*x^2)^(p + 1)*(c + d*x^2)^(q - 2)*S 
imp[c*(a*d - c*b*(2*p + 3)) + d*(a*d*(2*(q - 1) + 1) - b*c*(2*(p + q) + 1)) 
*x^2, x], x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, - 
1] && GtQ[q, 1] && IntBinomialQ[a, b, c, d, 2, p, q, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3670
Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^( 
p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[ff/f   Su 
bst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, Tan[e 
 + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]
 
3.3.94.4 Maple [A] (verified)

Time = 0.84 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.67

method result size
parallelrisch \(\frac {\left (48 a^{2}-3 b^{2}\right ) \sin \left (2 f x +2 e \right )+\left (-12 a b -3 b^{2}\right ) \sin \left (4 f x +4 e \right )+b^{2} \sin \left (6 f x +6 e \right )+96 f \left (a^{2}+\frac {1}{2} a b +\frac {1}{8} b^{2}\right ) x}{192 f}\) \(78\)
risch \(\frac {a^{2} x}{2}+\frac {a b x}{4}+\frac {b^{2} x}{16}+\frac {b^{2} \sin \left (6 f x +6 e \right )}{192 f}-\frac {\sin \left (4 f x +4 e \right ) a b}{16 f}-\frac {\sin \left (4 f x +4 e \right ) b^{2}}{64 f}+\frac {\sin \left (2 f x +2 e \right ) a^{2}}{4 f}-\frac {\sin \left (2 f x +2 e \right ) b^{2}}{64 f}\) \(103\)
derivativedivides \(\frac {a^{2} \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )+b^{2} \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \left (\sin ^{3}\left (f x +e \right )\right )}{6}-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{8}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{16}+\frac {f x}{16}+\frac {e}{16}\right )}{f}\) \(134\)
default \(\frac {a^{2} \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+2 a b \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )+b^{2} \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \left (\sin ^{3}\left (f x +e \right )\right )}{6}-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{8}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{16}+\frac {f x}{16}+\frac {e}{16}\right )}{f}\) \(134\)
norman \(\frac {\left (\frac {1}{2} a^{2}+\frac {1}{4} a b +\frac {1}{16} b^{2}\right ) x +\left (3 a^{2}+\frac {3}{2} a b +\frac {3}{8} b^{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a^{2}+\frac {3}{2} a b +\frac {3}{8} b^{2}\right ) x \left (\tan ^{10}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (10 a^{2}+5 a b +\frac {5}{4} b^{2}\right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {1}{2} a^{2}+\frac {1}{4} a b +\frac {1}{16} b^{2}\right ) x \left (\tan ^{12}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {15}{2} a^{2}+\frac {15}{4} a b +\frac {15}{16} b^{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {15}{2} a^{2}+\frac {15}{4} a b +\frac {15}{16} b^{2}\right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\frac {\left (8 a^{2}-4 a b -b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{8 f}-\frac {\left (8 a^{2}-4 a b -b^{2}\right ) \left (\tan ^{11}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{8 f}+\frac {\left (8 a^{2}+12 a b +19 b^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {\left (8 a^{2}+12 a b +19 b^{2}\right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}+\frac {\left (72 a^{2}+60 a b -17 b^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{24 f}-\frac {\left (72 a^{2}+60 a b -17 b^{2}\right ) \left (\tan ^{9}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{24 f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{6}}\) \(387\)

input
int(cos(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x,method=_RETURNVERBOSE)
 
output
1/192*((48*a^2-3*b^2)*sin(2*f*x+2*e)+(-12*a*b-3*b^2)*sin(4*f*x+4*e)+b^2*si 
n(6*f*x+6*e)+96*f*(a^2+1/2*a*b+1/8*b^2)*x)/f
 
3.3.94.5 Fricas [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.73 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} f x + {\left (8 \, b^{2} \cos \left (f x + e\right )^{5} - 2 \, {\left (12 \, a b + 7 \, b^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{48 \, f} \]

input
integrate(cos(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="fricas")
 
output
1/48*(3*(8*a^2 + 4*a*b + b^2)*f*x + (8*b^2*cos(f*x + e)^5 - 2*(12*a*b + 7* 
b^2)*cos(f*x + e)^3 + 3*(8*a^2 + 4*a*b + b^2)*cos(f*x + e))*sin(f*x + e))/ 
f
 
3.3.94.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 314 vs. \(2 (107) = 214\).

Time = 0.38 (sec) , antiderivative size = 314, normalized size of antiderivative = 2.71 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\begin {cases} \frac {a^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {a b x \sin ^{4}{\left (e + f x \right )}}{4} + \frac {a b x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a b x \cos ^{4}{\left (e + f x \right )}}{4} + \frac {a b \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{4 f} - \frac {a b \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{4 f} + \frac {b^{2} x \sin ^{6}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{4}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{4}{\left (e + f x \right )}}{16} + \frac {b^{2} x \cos ^{6}{\left (e + f x \right )}}{16} + \frac {b^{2} \sin ^{5}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{16 f} - \frac {b^{2} \sin ^{3}{\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{6 f} - \frac {b^{2} \sin {\left (e + f x \right )} \cos ^{5}{\left (e + f x \right )}}{16 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin ^{2}{\left (e \right )}\right )^{2} \cos ^{2}{\left (e \right )} & \text {otherwise} \end {cases} \]

input
integrate(cos(f*x+e)**2*(a+b*sin(f*x+e)**2)**2,x)
 
output
Piecewise((a**2*x*sin(e + f*x)**2/2 + a**2*x*cos(e + f*x)**2/2 + a**2*sin( 
e + f*x)*cos(e + f*x)/(2*f) + a*b*x*sin(e + f*x)**4/4 + a*b*x*sin(e + f*x) 
**2*cos(e + f*x)**2/2 + a*b*x*cos(e + f*x)**4/4 + a*b*sin(e + f*x)**3*cos( 
e + f*x)/(4*f) - a*b*sin(e + f*x)*cos(e + f*x)**3/(4*f) + b**2*x*sin(e + f 
*x)**6/16 + 3*b**2*x*sin(e + f*x)**4*cos(e + f*x)**2/16 + 3*b**2*x*sin(e + 
 f*x)**2*cos(e + f*x)**4/16 + b**2*x*cos(e + f*x)**6/16 + b**2*sin(e + f*x 
)**5*cos(e + f*x)/(16*f) - b**2*sin(e + f*x)**3*cos(e + f*x)**3/(6*f) - b* 
*2*sin(e + f*x)*cos(e + f*x)**5/(16*f), Ne(f, 0)), (x*(a + b*sin(e)**2)**2 
*cos(e)**2, True))
 
3.3.94.7 Maxima [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.09 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} {\left (f x + e\right )} + \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} + 8 \, {\left (6 \, a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} - 4 \, a b - b^{2}\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{6} + 3 \, \tan \left (f x + e\right )^{4} + 3 \, \tan \left (f x + e\right )^{2} + 1}}{48 \, f} \]

input
integrate(cos(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="maxima")
 
output
1/48*(3*(8*a^2 + 4*a*b + b^2)*(f*x + e) + (3*(8*a^2 + 4*a*b + b^2)*tan(f*x 
 + e)^5 + 8*(6*a^2 - b^2)*tan(f*x + e)^3 + 3*(8*a^2 - 4*a*b - b^2)*tan(f*x 
 + e))/(tan(f*x + e)^6 + 3*tan(f*x + e)^4 + 3*tan(f*x + e)^2 + 1))/f
 
3.3.94.8 Giac [A] (verification not implemented)

Time = 0.35 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.70 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=\frac {1}{16} \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} x + \frac {b^{2} \sin \left (6 \, f x + 6 \, e\right )}{192 \, f} - \frac {{\left (4 \, a b + b^{2}\right )} \sin \left (4 \, f x + 4 \, e\right )}{64 \, f} + \frac {{\left (16 \, a^{2} - b^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{64 \, f} \]

input
integrate(cos(f*x+e)^2*(a+b*sin(f*x+e)^2)^2,x, algorithm="giac")
 
output
1/16*(8*a^2 + 4*a*b + b^2)*x + 1/192*b^2*sin(6*f*x + 6*e)/f - 1/64*(4*a*b 
+ b^2)*sin(4*f*x + 4*e)/f + 1/64*(16*a^2 - b^2)*sin(2*f*x + 2*e)/f
 
3.3.94.9 Mupad [B] (verification not implemented)

Time = 14.51 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.03 \[ \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx=x\,\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )+\frac {\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^5+\left (a^2-\frac {b^2}{6}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^3+\left (\frac {a^2}{2}-\frac {a\,b}{4}-\frac {b^2}{16}\right )\,\mathrm {tan}\left (e+f\,x\right )}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^6+3\,{\mathrm {tan}\left (e+f\,x\right )}^4+3\,{\mathrm {tan}\left (e+f\,x\right )}^2+1\right )} \]

input
int(cos(e + f*x)^2*(a + b*sin(e + f*x)^2)^2,x)
 
output
x*((a*b)/4 + a^2/2 + b^2/16) + (tan(e + f*x)^3*(a^2 - b^2/6) - tan(e + f*x 
)*((a*b)/4 - a^2/2 + b^2/16) + tan(e + f*x)^5*((a*b)/4 + a^2/2 + b^2/16))/ 
(f*(3*tan(e + f*x)^2 + 3*tan(e + f*x)^4 + tan(e + f*x)^6 + 1))